<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License. 
-->
<html>
<head>
    <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css">
    <style type="text/css">
        .dp-highlighter {
            width:95% !important;
        }
    </style>
    <style type="text/css">
        .footer {
            background-image:      url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif');
            background-repeat:     repeat-x;
            background-position:   left top;
            padding-top:           4px;
            color:                 #666;
        }
    </style>
    <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' />
    <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' />
    <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script>
    <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script>
    <script type="text/javascript">
        SyntaxHighlighter.defaults['toolbar'] = false;
        SyntaxHighlighter.all();
    </script>
    <script type="text/javascript" language="javascript">
        var hide = null;
        var show = null;
        var children = null;

        function init() {
            /* Search form initialization */
            var form = document.forms['search'];
            if (form != null) {
                form.elements['domains'].value = location.hostname;
                form.elements['sitesearch'].value = location.hostname;
            }

            /* Children initialization */
            hide = document.getElementById('hide');
            show = document.getElementById('show');
            children = document.all != null ?
                    document.all['children'] :
                    document.getElementById('children');
            if (children != null) {
                children.style.display = 'none';
                show.style.display = 'inline';
                hide.style.display = 'none';
            }
        }

        function showChildren() {
            children.style.display = 'block';
            show.style.display = 'none';
            hide.style.display = 'inline';
        }

        function hideChildren() {
            children.style.display = 'none';
            show.style.display = 'inline';
            hide.style.display = 'none';
        }
    </script>
    <title>SiteGraph Plugin</title>
</head>
<body onload="init()">
<table border="0" cellpadding="2" cellspacing="0" width="100%">
    <tr class="topBar">
        <td align="left" valign="middle" class="topBarDiv" align="left" nowrap>
            &nbsp;<a href="home.html">Home</a>&nbsp;&gt;&nbsp;<a href="guides.html">Guides</a>&nbsp;&gt;&nbsp;<a href="plugin-developers-guide.html">Plugin Developers Guide</a>&nbsp;&gt;&nbsp;<a href="sitegraph-plugin.html">SiteGraph Plugin</a>
        </td>
        <td align="right" valign="middle" nowrap>
            <form name="search" action="https://www.google.com/search" method="get">
                <input type="hidden" name="ie" value="UTF-8" />
                <input type="hidden" name="oe" value="UTF-8" />
                <input type="hidden" name="domains" value="" />
                <input type="hidden" name="sitesearch" value="" />
                <input type="text" name="q" maxlength="255" value="" />
                <input type="submit" name="btnG" value="Google Search" />
            </form>
        </td>
    </tr>
</table>

<div id="PageContent">
    <div class="pageheader" style="padding: 6px 0px 0px 0px;">
        <!-- We'll enable this once we figure out how to access (and save) the logo resource -->
        <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"-->
        <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div>
        <div style="margin: 0px 10px 8px 10px"  class="pagetitle">SiteGraph Plugin</div>

        <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
            <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14137">
                <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a>
            <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14137">Edit Page</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">
                <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a>
            <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14137">
                <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Add Page"></a>
            <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14137">Add Page</a>
            &nbsp;
            <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14137">
                <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif"
                     height="16" width="16" border="0" align="absmiddle" title="Add News"></a>
            <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14137">Add News</a>
        </div>
    </div>

    <div class="pagecontent">
        <div class="wiki-content">
            <div id="ConfluenceContent"><p>The SiteGraph plugingenerates graphical diagrams representing the flow of your web application.</p><p>SiteGraph works by parsing your configuration files, Action classes, and view files (JSP, Velocity, and FreeMarker), and displaying a visual map.</p><p>Additional information can be found in the JavaDocs:</p><p></p><p>
SiteGraph is a tool that renders out GraphViz-generated images depicting your
Struts-powered web application's flow. SiteGraph requires GraphViz be installed
and that the "dot" executable be in your command path. You can find GraphViz
at http://www.graphviz.org.
</p><h4 id="SiteGraphPlugin-UnderstandingtheOutput">Understanding the Output</h4><p>There are several key things to notice when looking at the output from SiteGraph:</p><ul><li>Boxes: those shaded red indicate an action; those shaded green indicate a view file (JSP, etc).</li><li>Links: arrows colored green imply that no new HTTP request is being made; black arrows indicate a new HTTP request.</li><li>Link labels: labels may sometimes contain additional useful information. For example, a label of <strong>href</strong> means that the link behavior is that of a hyper-text reference. The complete label behaviors are provided:<ul><li><strong>href</strong> - a view file references an action by name (typically ending with the extension ".action")</li><li><strong>action</strong> - a view file makes a call to the <a shape="rect" href="action.html">action</a> tag</li><li><strong>form</strong> - a view file is linked to an action using the <a shape="rect" href="form.html">form</a> tag</li><li><strong>redirect</strong> - an action is redirecting to another view or action</li><li><strong>! notation</strong> - a link to an action overrides the method to invoke</li></ul></li></ul><h4 id="SiteGraphPlugin-Requirements">Requirements</h4><p>SiteGraph requires that your view files be structured in a very specific way. Because it has to read these files, only certain styles are supported. The requirements are:</p><ul><li>The JSP tags must use the "s" namespace.<ul><li>In JSP: &lt;s:xxx/&gt;</li><li>In FreeMarker: &lt;@s.xxx/&gt;</li><li>In Velocity: N/A</li></ul></li><li>Use of the <a shape="rect" href="form.html">form</a> tag and <a shape="rect" href="action.html">action</a> tag must be linking directly to the action name (and optional namespace). This means that &lt;s:form action="foo"/&gt; is OK, but &lt;s:form action="foo.action"/&gt; is not.<br clear="none"> Here is also a short overview of what it does and why a developer would want to use it.</li></ul><h4 id="SiteGraphPlugin-Features">Features</h4><ul><li>Generates a graphical view of your web application</li></ul><h2 id="SiteGraphPlugin-Usage">Usage</h2><p>You can use SiteGraph with the following command:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">java -cp ... -jar struts2-sitegraph-plugin-x.x.x.jar
     -config CONFIG_DIR
     -views VIEWS_DIRS
     -output OUTPUT
     [-ns NAMESPACE]
</pre>
</div></div><p>Where:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: plain; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
Usage: -config CONFIG_DIR -views VIEWS_DIRS -output OUTPUT [-ns NAMESPACE]
       CONFIG_DIR =&gt; a directory containing struts.xml
       VIEWS_DIRS =&gt; comma seperated list of dirs containing JSPs, VMs, etc
       OUPUT      =&gt; the directory where the output should go
       NAMESPACE  =&gt; the namespace path restriction (/, /foo, etc)
]]></script>
</div></div><div class="confluence-information-macro confluence-information-macro-warning"><span class="aui-icon aui-icon-small aui-iconfont-error confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>You must either supply the correct classpath when invoking the SiteGraph tool or place the Sitegraph plugin in the same directory as the dependent jars. Specifically, the XWork jar, Struts jar, and their dependencies must be included in the classpath. Futhermore, <strong>you must also include your Action class files referenced in</strong> <code><strong>struts.xml</strong></code>. Without the proper class path entries, SiteGraph will not function properly.</p></div></div><p>Once you have run SiteGraph, check the directory specified in the "output" argument (OUTPUT). In there you will find two files: <strong>out.dot</strong> and <strong>out.gif</strong>. You may immediately open up <strong>out.gif</strong> and view the web application flow. However, you may also wish to either run the <strong>out.dot</strong> file through a different GraphVis layout engine (neato, twopi, etc), so the original dot file is provided as well. You may also wish to edit the dot file before rendering the final flow diagram.</p><h4 id="SiteGraphPlugin-AutomaticExecution">Automatic Execution</h4><p>Some advanced users may wish to execute SiteGraph from within their application - this could be required if you are developing an application that supports plugin capabilities. This can easily be done. See the JavaDocs for more info:</p><p></p><p>
If you wish to use SiteGraph through its API rather than through the command line,
you can do that as well. All you need to do is create a new SiteGraph instance,
optionally specify a Writer to output the dot content to, and then call
#prepare().
</p><p>The command line version of SiteGraph does exactly this (except for overriding the Writer):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
SiteGraph siteGraph = new SiteGraph(configDir, views, output, namespace);
siteGraph.prepare();
siteGraph.render();
]]></script>
</div></div><h4 id="SiteGraphPlugin-Example">Example</h4><p>

    
    
    

</p><div class="gallery">
        <table><tr><td colspan="1" rowspan="1" class="gallery-image" style="width: 300px">
                    <img class="confluence-embedded-image" border="0" src="sitegraph-plugin.thumbs/example.gif" width="300" height="243" data-image-src="/confluence/download/attachments/14137/example.gif?version=1&amp;modificationDate=1119906238000&amp;api=v2" data-linked-resource-default-alias="example.gif" data-linked-resource-id="1601" data-linked-resource-container-id="14137">
                </td></tr><tr><td colspan="1" rowspan="1" style="width: 300px">
                    <div class="gallery-caption"></div>
                </td></tr></table>
</div>
<h4 id="SiteGraphPlugin-Settings">Settings</h4><p>This plugin doesn't allow for any global settings.</p><h4 id="SiteGraphPlugin-Installation">Installation</h4><p>The SiteGraph plugin jar is distributed with Struts, so if you're up and running, you don't need to do download any additional Java packages. However, SiteGraph does require the "dot" package by <a shape="rect" class="external-link" href="http://www.graphviz.org" rel="nofollow">GraphViz</a>.</p><p>You'll need to download the latest version of GraphViz and make sure that the dot executable (dot.exe in Windows) is in your command path. In Windows the GraphViz installer typically automatically adds <code>dot.exe</code> to your path. However, you may need to do this by hand depending on your system configuration.</p></div>
        </div>

        
    </div>
</div>
<div class="footer">
    Generated by CXF SiteExporter
</div>
</body>
</html>
